﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OracleClient;
public partial class changyong_jinhuo : System.Web.UI.Page
{
    OracleConnection con = new OracleConnection("Data Source=orcl;Persist Security Info=True;User ID=booksale;Password=Qwertyuiop1;Unicode=True");
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        string sql = "insert into booksale.stock(ISBM,图书名称,出版社,供应商,类别,负责人) values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "')";

        OracleCommand com = new OracleCommand(sql, con);

        if (con.State.Equals(ConnectionState.Closed))
        { con.Open(); }
        if (Convert.ToInt32(com.ExecuteNonQuery()) > 0)
        { Response.Write("<script language=javascript>alert('添加成功');</script>"); }
        else
        { Response.Write("<script language=javascript>alert('添加失败');</script>"); }
        if (con.State.Equals(ConnectionState.Open))
        { con.Close(); }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text = TextBox2.Text = TextBox3.Text = TextBox4.Text = TextBox5.Text =TextBox6.Text= " ";
    }
}